//
//  Data Structures Tutorial
//
//  Copyright 2014 by Balamurugan Souppourayen <srimuruganbala@gmail.com>
//
//  Licensed under GNU General Public License 3.0 or later.
//  Some rights reserved. See COPYING, AUTHORS.
//
//  @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
//

#ifndef LinkedList_TLinkedList_h
#define LinkedList_TLinkedList_h

#include <cstdlib>
#include <cstdint>

using namespace std;

class TLinkedList {
  class TNode {
  public:
    int32_t Data;
    TNode* Next;

    TNode(int32_t data, TNode* next);
  };

  TNode* Header;
  size_t ListSize;

  TNode& Goto(size_t index);

public:
  TLinkedList();
  ~TLinkedList();

  int32_t operator[](size_t index);
  size_t Size();
  void PushFront(int32_t data);
  size_t PushBack(int32_t data);
  void Insert(size_t index, int32_t data);
  void Delete(size_t index);
  void Clear();
  void PrintList();
};

#endif
